﻿

using System.Linq;
using Patterns4Net.Attributes;
using Patterns4Net.Tests.ArchitectureExplorer.Diagram;

namespace Patterns4Net.Tests.ArchitectureExplorer.ViewModels.Graph
{
    using NUnit.Framework;

    [TestFixture]
    public class GraphFactoryCreateGraphForLayerTest : GraphViewModelFactoryTestBase
    {
        [SetUp]
        protected override void SetUp()
        {
            base.SetUp();
        }

        [Test]
        public void When_Enough_Higher_Level_Types_Are_Present_Only_These_Types_Are_Displayed()
        {
            var diagramBuilder = new DiagramBuilder();
            diagramBuilder.AddLayer("test-layer")
                .AddPackage("test-package")
                .Add("classA", AbstractionLevel.Normal)
                .Add("classB", AbstractionLevel.Higher)
                .Add("classC", AbstractionLevel.Low)
                .Add("classD", AbstractionLevel.Higher);
            var diagram = diagramBuilder.Build();
            var viewModel = this.CreateDiagramViewModel(diagram);

            var result = this.GraphsFactory.CreateGraphForLayer(viewModel, diagram.Layers.First());

            new GraphViewModelAssert(result)
                .HasSubGraph("test-package")
                .HasVertex("classB")
                .HasVertex("classD");
        }
    }
}
